import { Constants } from '../constants'
import { DataTypes, Sequelize } from 'sequelize'
import { BaseModel, BaseModelAttribute } from './baseModel'
import { ModelUtils } from './modelUtils'
interface AssetAttribute extends BaseModelAttribute {
  name: string
  amount: number
  date: Date
}
export class Asset extends BaseModel<AssetAttribute> {
  name: string
  amount: number
  date: Date
}
export class AssetInit {
  static init(sequelizeInstance: Sequelize) {
    Asset.init(ModelUtils.appendPublicFields({
      name: { type: DataTypes.STRING, allowNull: false, comment: '资产名' },
      amount: { type: DataTypes.DECIMAL, allowNull: false, comment: Constants.amount },
      date: { type: DataTypes.DATE, allowNull: false, comment: Constants.date },
    }), ModelUtils.appendTablePublicProperties('asset', sequelizeInstance, '名称文本'))
  }
}